package com.example.shop.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.shop.pojo.EvaluationPicture;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface EvaluationPictureMapper extends BaseMapper<EvaluationPicture> {
    @Select("select * from r_evaluation_picture where evaluation_id=#{evaluationId}")
    List<EvaluationPicture> selectById(@Param("evaluationId") Long evaluationId);

    @Select("select evaluation_picture from r_evaluation_picture where evaluation_id=#{evaluationId}")
    List<String> selectPictureById(@Param("evaluationId") Long evaluationId);

    @Insert("<script>" +
            "insert r_evaluation_picture(evaluation_id,evaluation_picture) " +
            "VALUES " +
            "<foreach collection='evaluationPictureList' item='ep' separator=',' >" +
                "(${ep.evaluationId},#{ep.evaluationPicture})" +
            "</foreach>"+
            "</script>")
    int batchInsert(@Param("evaluationPictureList") List<EvaluationPicture> evaluationPictureList);

}
